package biz.datalk.industrialland.admin.modules.online.dynform.controller;

import biz.datalk.industrialland.admin.modules.online.dynform.pojo.dto.DynformEnhanceJsDTO;
import biz.datalk.industrialland.admin.modules.online.dynform.service.IDynformEnhanceJsService;
import biz.datalk.industrialland.common.encrypt.annotation.RSAES;
import biz.datalk.industrialland.common.result.UnifyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @author tarofang@163.com
 * @date 2020-01-06
 *
 */
@RestController
@RequestMapping("/dynform/js")
public class DynformEnhanceJsController {

    private final IDynformEnhanceJsService dynformEnhanceJsService;

    @Autowired
    public DynformEnhanceJsController(IDynformEnhanceJsService dynformEnhanceJsService) {
        this.dynformEnhanceJsService = dynformEnhanceJsService;
    }

    @RSAES
    @PostMapping(value = "/olist", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public UnifyResult olist(@RequestBody DynformEnhanceJsDTO dynformEnhanceJsDTO) {
        return dynformEnhanceJsService.olist(dynformEnhanceJsDTO);
    }

    @RSAES
    @PostMapping(value = "/oform", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public UnifyResult oform(@RequestBody DynformEnhanceJsDTO dynformEnhanceJsDTO) {
        return dynformEnhanceJsService.oform(dynformEnhanceJsDTO);
    }

    @RSAES
    @PostMapping(value = "/save", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public UnifyResult save(@RequestBody DynformEnhanceJsDTO dynformEnhanceJsDTO) {
        return dynformEnhanceJsService.save(dynformEnhanceJsDTO);
    }


}
